const initState = {
	nickname: '',
	role: '',
	token: '',
	avator: ''
}

const userReducer = (state = initState, action) => {
	switch (action.type) {
		case 'loginSuccess': {
			return {
				...action.payload
			}
		}
		case 'quit': {
			return {
				nickname: '',
				role: '',
				token: '',
				avator: ''
			}
		}
	}
	return state
}

export default userReducer